SciChart WPF 3D Charts > Tutorials > Code-Behind > Tutorial 02-3D - Creating a SciChart3DSurface
Tutorial 02-3D - Creating a SciChart3DSurface

The SciChart3DSurface Type

The root 3D chart control is called the SciChart3DSurface and provides a high performance DirectX powered 3D chart surface. This is the WPF Control you will be adding to your applications wherever you need a 3D chart. You can add more than one SciChart3DSurface and configure them independently.

Source code for this tutorial can be found at our SciChart.WPF.Examples Github Repository under Tutorials section.

Declaring a SciChart3DSurface Instance

After referencing the SciChart 3D DLLs from NuGet (package: SciChart3D), from local DLL files (referencing DLLs SciChart.Core, SciChart.Data, SciChart.Drawing, SciChart.Charting and SciChart.Charting3D) or the SciChart 3D Source from GitHub, a SciChart3DSurface instance can be declared as follows:

Declaring a SciChart3DSurface Instance in XAML
Copy Code
<Window x:Class="Tutorial_02_Creating_a_SciChart3DSurface.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:s3D="http://schemas.abtsoftware.co.uk/scichart3D"
        Title="Tutorial 02 - Creating a SciChart3DSurface"
        Height="550"
        Width="800">

    <Grid>
        <!--  Create the chart surface  -->
        <!--  where xmlns:s3D="http://schemas.abtsoftware.co.uk/scichart3D"  -->
        <s3D:SciChart3DSurface x:Name="sciChart3DSurface">
            <!--  Create an X Axis  -->
            <s3D:SciChart3DSurface.XAxis>
                <s3D:NumericAxis3D AxisTitle="X-Axis 3D"/>
            </s3D:SciChart3DSurface.XAxis>
            <!--  Create a Y Axis  -->
            <s3D:SciChart3DSurface.YAxis>
                <s3D:NumericAxis3D AxisTitle="Y-Axis 3D"/>
            </s3D:SciChart3DSurface.YAxis>
            <!--  Create a Z Axis  -->
            <s3D:SciChart3DSurface.ZAxis>
                <s3D:NumericAxis3D AxisTitle="Z-Axis 3D"/>
            </s3D:SciChart3DSurface.ZAxis>
            <!--  Specify interactivity modifiers  -->
            <s3D:SciChart3DSurface.ChartModifier>
                <s3D:ModifierGroup3D>
                    <s3D:OrbitModifier3D/>
                    <s3D:ZoomExtentsModifier3D/>
                </s3D:ModifierGroup3D>
            </s3D:SciChart3DSurface.ChartModifier>
        </s3D:SciChart3DSurface>
    </Grid>
</Window>
Declaring a SciChart3DSurface Instance in Code
Copy Code
// Create the chart surface
var sciChart3DSurface = new SciChart3DSurface();

// Create the X, Y and Z axes
var xAxis = new NumericAxis3D { AxisTitle = "X-Axis 3D" };
var yAxis = new NumericAxis3D { AxisTitle = "Y-Axis 3D" };
var zAxis = new NumericAxis3D { AxisTitle = "Z-Axis 3D" };

sciChart3DSurface.XAxis = xAxis;
sciChart3DSurface.YAxis = yAxis;
sciChart3DSurface.ZAxis = zAxis;

// Specify Interactivity Modifiers
sciChart3DSurface.ChartModifier = new ModifierGroup3D(
new OrbitModifier3D(), new ZoomExtentsModifier3D()); 

The above code declares a SciChart3DSurface, adds numeric X, Y and Z axes, adds orbit (rotation around camera target) and zoom behaviors. If you declared it in XAML, you should be able to see it in the WPF Designer.

Congratulations, you have just created your first SciChart3DSurface!

See Also